cmake_minimum_required(VERSION 3.3)

set(database_head
        MySQLConnection.h
        ConnectionPool.h
        )

set(LIBDATABASE_SRC
        MySQLConnection.cpp
        ConnectionPool.cpp)

set(INC_DIR /www/server/mysql/include )
#声明头文件路径，安装mysql的include文件夹，文件路径中有空格的地方，在空格前加上转义

set(LINK_DIR /www/server/mysql/bin)
#声明链接库路径，安装mysql的lib文件夹，

include_directories(${INC_DIR}) #引入头文件

link_directories(${LINK_DIR}) #引入库文件

add_library(database SHARED ${LIBDATABASE_SRC})
link_libraries(libmysqlclient.so)
target_link_libraries(database libmysqlclient.so)
target_link_libraries(database base)

install(FILES ${database_head} DESTINATION include/myMuduo/database)
install(TARGETS database DESTINATION lib)
